import 'package:aweb5/bean/aplus/group_plan_list_entity.dart';
import 'package:video_player/video_player.dart';

groupPlanListEntityFromJson(GroupPlanListEntity data, Map<String, dynamic> json) {
	if (json['msg'] != null) {
		data.msg = json['msg']?.toString();
	}
	if (json['data'] != null) {
		data.data = new GroupPlanListData().fromJson(json['data']);
	}
	if (json['code'] != null) {
		data.code = json['code']?.toInt();
	}
	return data;
}

Map<String, dynamic> groupPlanListEntityToJson(GroupPlanListEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['code'] = entity.code;
	return data;
}

groupPlanListDataFromJson(GroupPlanListData data, Map<String, dynamic> json) {
	if (json['group'] != null) {
		data.group = new List<GroupPlanListDataGroup>();
		(json['group'] as List).forEach((v) {
			data.group.add(new GroupPlanListDataGroup().fromJson(v));
		});
	}
	if (json['time_data'] != null) {
		data.timeData = new List<GroupPlanListDataTimeData>();
		(json['time_data'] as List).forEach((v) {
			data.timeData.add(new GroupPlanListDataTimeData().fromJson(v));
		});
	}
//	if (json['member'] != null) {
//		data.member = new GroupPlanListDataMember().fromJson(json['member']);
//	}
	if (json['follow'] != null) {
		data.follow = new GroupPlanListDataFollow().fromJson(json['follow']);
	}
	return data;
}

Map<String, dynamic> groupPlanListDataToJson(GroupPlanListData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.group != null) {
		data['group'] =  entity.group.map((v) => v.toJson()).toList();
	}
	if (entity.timeData != null) {
		data['time_data'] =  entity.timeData.map((v) => v.toJson()).toList();
	}
//	if (entity.member != null) {
//		data['member'] = entity.member.toJson();
//	}
	if (entity.follow != null) {
		data['follow'] = entity.follow.toJson();
	}
	return data;
}

groupPlanListDataGroupFromJson(GroupPlanListDataGroup data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['wx_group_name'] != null) {
		data.wxGroupName = json['wx_group_name']?.toString();
	}
	if (json['is_default'] != null) {
		data.isDefault = json['is_default']?.toInt();
	}
	return data;
}

Map<String, dynamic> groupPlanListDataGroupToJson(GroupPlanListDataGroup entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['wx_group_name'] = entity.wxGroupName;
	data['is_default'] = entity.isDefault;
	return data;
}

groupPlanListDataTimeDataFromJson(GroupPlanListDataTimeData data, Map<String, dynamic> json) {
	if (json['week'] != null) {
		data.week = json['week']?.toString();
	}
	if (json['is_default'] != null) {
		data.isDefault = json['is_default']?.toInt();
	}
	if (json['date'] != null) {
		data.date = json['date']?.toString();
	}
	if (json['date_month'] != null) {
		data.dateMonth = json['date_month']?.toString();
	}
	if (json['task_send'] != null) {
		data.taskSend = new List<GroupPlanListDataTimeDataTaskSend>();
		(json['task_send'] as List).forEach((v) {
			data.taskSend.add(new GroupPlanListDataTimeDataTaskSend().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> groupPlanListDataTimeDataToJson(GroupPlanListDataTimeData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['week'] = entity.week;
	data['is_default'] = entity.isDefault;
	data['date'] = entity.date;
	data['date_month'] = entity.dateMonth;
	if (entity.taskSend != null) {
		data['task_send'] =  entity.taskSend.map((v) => v.toJson()).toList();
	}
	return data;
}

groupPlanListDataTimeDataTaskSendFromJson(GroupPlanListDataTimeDataTaskSend data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['send_time'] != null) {
		data.sendTime = json['send_time']?.toString();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['is_send'] != null) {
		data.isSend = json['is_send']?.toInt();
	}
	if (json['info'] != null) {
		data.info = new List<GroupPlanListDataTimeDataTaskSendInfo>();
		(json['info'] as List).forEach((v) {
			data.info.add(new GroupPlanListDataTimeDataTaskSendInfo().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> groupPlanListDataTimeDataTaskSendToJson(GroupPlanListDataTimeDataTaskSend entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['send_time'] = entity.sendTime;
	data['name'] = entity.name;
	data['is_send'] = entity.isSend;
	if (entity.info != null) {
		data['info'] =  entity.info.map((v) => v.toJson()).toList();
	}
	return data;
}

groupPlanListDataTimeDataTaskSendInfoFromJson(GroupPlanListDataTimeDataTaskSendInfo data, Map<String, dynamic> json) {
	if (json['type'] != null) {
		data.type = json['type']?.toInt();
	}
	if (json['data'] != null) {
		data.data = json['data']?.toString();
	}
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['index'] != null) {
		data.index = json['index']?.toInt();
	}
	if (json['linkTitle'] != null) {
		data.linkTitle = json['linkTitle']?.toString();
	}
	if (json['linkPrice'] != null) {
		data.linkPrice = json['linkPrice']?.toString();
	}
//	if (json['controller'] != null) {
//		data.controller = new VideoPlayerController().fromJson(json['controller']);
//	}
	return data;
}

Map<String, dynamic> groupPlanListDataTimeDataTaskSendInfoToJson(GroupPlanListDataTimeDataTaskSendInfo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['type'] = entity.type;
	data['data'] = entity.data;
	data['id'] = entity.id;
	data['index'] = entity.index;
	data['linkTitle'] = entity.linkTitle;
	data['linkPrice'] = entity.linkPrice;
//	if (entity.controller != null) {
//		data['controller'] = entity.controller.toJson();
//	}
	return data;
}

//groupPlanListDataMemberFromJson(GroupPlanListDataMember data, Map<String, dynamic> json) {
//	if (json['name'] != null) {
//		data.name = json['name']?.toString();
//	}
//	if (json['nickname'] != null) {
//		data.nickname = json['nickname']?.toString();
//	}
//	if (json['headimgurl'] != null) {
//		data.headimgurl = json['headimgurl']?.toString();
//	}
//	return data;
//}

//Map<String, dynamic> groupPlanListDataMemberToJson(GroupPlanListDataMember entity) {
//	final Map<String, dynamic> data = new Map<String, dynamic>();
//	data['name'] = entity.name;
//	data['nickname'] = entity.nickname;
//	data['headimgurl'] = entity.headimgurl;
//	return data;
//}

groupPlanListDataFollowFromJson(GroupPlanListDataFollow data, Map<String, dynamic> json) {
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['is_official'] != null) {
		data.isOfficial = json['is_official']?.toInt();
	}
	if (json['headimgurl'] != null) {
		data.headimgurl = json['headimgurl']?.toString();
	}
	return data;
}

Map<String, dynamic> groupPlanListDataFollowToJson(GroupPlanListDataFollow entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['name'] = entity.name;
	data['is_official'] = entity.isOfficial;
	data['headimgurl'] = entity.headimgurl;
	return data;
}